class BancosController < ApplicationController
  # GET /bancos
  # GET /bancos.xml
  def index
    @bancos = Banco.find(:all)

    respond_to do |format|
      format.html # index.rhtml
      format.xml  { render :xml => @bancos.to_xml }
    end
  end

  # GET /bancos/1
  # GET /bancos/1.xml
  def show
    @banco = Banco.find(params[:id])

    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @banco.to_xml }
    end
  end

  # GET /bancos/new
  def new
    @banco = Banco.new
  end

  # GET /bancos/1;edit
  def edit
    @banco = Banco.find(params[:id])
  end

  # POST /bancos
  # POST /bancos.xml
  def create
    @banco = Banco.new(params[:banco])

    respond_to do |format|
      if @banco.save
        flash[:notice] = 'Banco was successfully created.'
        format.html { redirect_to banco_url(@banco) }
        format.xml  { head :created, :location => banco_url(@banco) }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @banco.errors.to_xml }
      end
    end
  end

  # PUT /bancos/1
  # PUT /bancos/1.xml
  def update
    @banco = Banco.find(params[:id])

    respond_to do |format|
      if @banco.update_attributes(params[:banco])
        flash[:notice] = 'Banco was successfully updated.'
        format.html { redirect_to banco_url(@banco) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @banco.errors.to_xml }
      end
    end
  end

  # DELETE /bancos/1
  # DELETE /bancos/1.xml
  def destroy
    @banco = Banco.find(params[:id])
    @banco.destroy

    respond_to do |format|
      format.html { redirect_to bancos_url }
      format.xml  { head :ok }
    end
  end
end
